<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page language="java"  import="java.util.Date"%>
<%@ include file="/pages/safeai/jsp/common/taglibs.jsp"%>
<html>
	<head>
		<title>前台管理--活动管理--添加活动</title>
		<%@ include file="/pages/safeai/jsp/common/meta.jsp"%>
		<link href="${ctx}/css/safeai/together.css" rel="stylesheet"
			type="text/css">

	</head>

	<body>
		<%@ include file="/pages/safeai/jsp/common/taglibs.jsp"%>
		<%
			Date d = new Date();
			Long time = d.getTime();
		%>
		<html:form method="post" action="/others/activityManage.do"
			enctype="multipart/form-data" focus="activity.title">
			<input type="hidden" name="method" value="insert" />
			<logic:present name="activity">
				<input type="hidden" name="activity.publishUser"
					value="${activity.publishUser}" />
				<input type="hidden" name="activity.del" value="${activity.del}" />
			</logic:present>
			<table align="center" width="350px">
				<tr>
					<th colspan="2">
						添加活动
					</th>
				<tr>
					<td class="td_01">
						标题：
					</td>
					<td class="td_03">
						<input type="text" name="activity.title" value="" />
					</td>
				</tr>
				<tr>
					<td class="td_01">
						简介：
					</td>
					<td class="td_03">
						<textarea rows="3" cols="25" name="activity.summaryinfo" ></textarea>
					</td>
				</TR>
				<tr>
					<td nowrap class="td_01">
						图片
					</td>
					<td class="td_03">
						<a href="javaScript:void(0);"> <img height="80"
								src="${ctx}/${activity.imageUrl}?time=<%=time%>" width="80" />
						</a>&nbsp;&nbsp;
						<span style="color: red;">注：图片尺寸： 500*500,格式为：.JPG,大小为：10Mb</span>
						<br>
						<input type="file" value="${activity.imageUrl}"
							name="activity.imageFile"
							onkeypress="alert('不允许手工填写'); window.event.returnValue=false;" />
						<input type="hidden" value="${activity.imageUrl}" name="oldImage" />
						<br />
						<font color="red">${file1}</font>
					</td>
				</tr>
				<tr>
					<td class="td_01">
						顺序：
					</td>
					<td class="td_03">
						<input type="text" name="activity.sequence" value="0"
							id="sequence" onchange="testisNum('sequence')" />
					</td>
				</TR>
				<tr>
					<td class="td_01">
						链接地址：
					</td>
					<td class="td_03">
						<input type="text" name="activity.urllink" value="" />
					</td>
				</TR>
				<tr>
					<td class="td_01">
						内容：
					</td>
					<td class="td_03">
						<textarea rows="10" cols="20" name="activity.content" id="content"></textarea>
					</td>
				</TR>
				<tr>
					<td colspan="2" class="td_01">
						<input name="submit" class="btn" type="submit" value="提交">
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<input type="button" class="btn" name="return" value="返回"
							onmousedown="javascript:history.go(-1);" />
					</td>
				</TR>
			</table>
		</html:form>

	</body>
	<script type="text/javascript">
	 function testisNum(id){
	 var object=document.getElementById(id);
      var s =document.getElementById(object.id).value;
          if(s!=""){
             if(isNaN(s)){
                 alert("请输入数字");
                 object.value=0;
                 object.focus();
                 return;
             }
          }else{
                 alert("此处不能为空！默认值为0！");
                 object.value=0;
                 object.focus();
                 return;
          }
   }
      //获得内容控件
   var content=document.getElementById("content");
   content.onchange=function(){
       var str=content.value;
       str=bb(aa(str));
       content.value=str;
   }
  function aa(str){
        return   str.replace(/^[\s]+/,"");   
  }     
  function bb(str){
        return   str.replace(/[\s]+$/,"");
  }  
	</script>
</html>
